I have an Go routine running a concurrent TCP 4 server, but everytime I connect to it from via Dial, the TCP server throws an error saying only "EOF". Interestingly it is processing the first line of data, but then the connection handle throws the error.
tcp server instance:
if err != nil {
fmt.Println("an error occured: ")
fmt.Println(err)
return
}
defer l.Close()
for {
conn, err_handle := l.Accept()
if err_handle != nil {
fmt.Println("node err: ",err_handle)
return
}
go handle_Connection(conn, topics)
}
handle_Connection:
func handle_Connection(conn net.Conn, topics map[string][]string) {
defer conn.Close()
fmt.Println("client connected")
for {
data, err_handle := bufio.NewReader(conn).ReadString('\n')
if err_handle != nil {
fmt.Println("Err: ", err_handle)
return
}
client:
conn, err := net.Dial("tcp4", ":"+strconv.Itoa(port))
if err != nil {
fmt.Println("an error occured: ")
fmt.Println(err)
}